from django.db import models

# Create your models here.

class AlarmRecord(models.Model):
    scope = models.CharField('范围', max_length=50)
    service_name = models.CharField('服务名称', max_length=200)
    rule_name = models.CharField('规则名称', max_length=100)
    alarm_message = models.CharField('告警信息', max_length=2000)
    alarm_time = models.CharField('告警时间', max_length=100)
    business = models.CharField('业务', max_length=20)

    def __str__(self):
        return self.service_name

    class Meta:
        verbose_name = '告警记录'

class EmployeeAndServiceInfo(models.Model):
    emp_id = models.CharField('员工id', max_length=50)
    emp_name = models.CharField('员工姓名', max_length=50, default=None)
    service_name = models.CharField('服务名称', max_length=50)

    def __str__(self):
        return "%s-%s" % (self.emp_name, self.service_name)

    class Meta:
        verbose_name = '员工对应服务'
        unique_together = ('emp_id', 'emp_name', 'service_name',)
